<!DOCTYPE html>
<html>
<head>
  <title>layout 药品销售系统 - Layui</title>
   {% load static %}
        <meta charset="UTF-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="{% static 'css/font.css' %}">
        <link rel="stylesheet" href="{% static 'css/xadmin.css' %}">
        <script type="text/javascript" src="{% static 'lib/layui/layui.js' %}" charset="utf-8"></script>
        <script type="text/javascript" src="{% static 'js/xadmin.js' %}"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
</head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header" >
    <div class="layui-logo">药品进销存管理系统</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item">
        <a href="javascript:;">信息中心</a>
        <dl class="layui-nav-child">
            <dd><a href="/medicine/">药品信息</a></dd>
            <dd><a href="/worker/">员工信息</a></dd>
            <dd><a href="/customer/">客户信息</a></dd>
            <dd><a href="/producer/">厂家信息</a></dd>
            <dd><a href="/store/">库存信息</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="/purchase/">采购</a></li>
      <li class="layui-nav-item"><a href="/sell/">销售</a></li><li class="layui-nav-item"><a href="/medicine_producer/">药品厂家</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd><dd><a href="/gotoaddsuperuser/">用户管理</a></dd>
        </dl>
      </li>
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          {{ username }}
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="/logoutapi/">退出</a></li>
    </ul>
  </div>

  <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
          <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
          <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                  <a class="" href="javascript:;">信息中心</a>
                  <dl class="layui-nav-child">
                        <li class="layui-nav-item">
                          <a href="javascript:;">药品信息</a>
                          <dl class="layui-nav-child">
                                <dd><a href="medicine/add">添加药品</a></dd>
                                <dd><a href="/medicine/update">修改药品</a></dd>
                                <dd><a href="/medicine/select">查找药品</a></dd>
                                <dd><a href="/medicine/delete">删除药品</a></dd>
                          </dl>
                        </li>
                        <li class="layui-nav-item">
                          <a href="javascript:;">员工信息</a>
                          <dl class="layui-nav-child">
                                <dd><a href="javascript:;">添加员工</a></dd>
                                <dd><a href="javascript:;">修改员工</a></dd>
                                <dd><a href="javascript:;">查找员工</a></dd>
                                <dd><a href="javascript:;">删除员工</a></dd>
                          </dl>
                        </li>
                        <li class="layui-nav-item">
                          <a href="javascript:;">客户信息</a>
                          <dl class="layui-nav-child">
                                <dd><a href="javascript:;">添加客户</a></dd>
                                <dd><a href="javascript:;">修改客户</a></dd>
                                <dd><a href="javascript:;">查找客户</a></dd>
                                <dd><a href="javascript:;">删除客户</a></dd>
                          </dl>
                        </li>
                        <li class="layui-nav-item">
                            <a href="javascript:;">厂家信息</a>
                          <dl class="layui-nav-child">
                            <dd><a href="javascript:;">添加厂家信息</a></dd>
                            <dd><a href="javascript:;">修改厂家信息</a></dd>
                            <dd><a href="javascript:;">查找厂家信息</a></dd>
                              <dd><a href="javascript:;">删除厂家信息</a></dd>
                          </dl>
                        </li>
                        <li class="layui-nav-item">
                          <a href="javascript:;">库存信息</a>
                          <dl class="layui-nav-child">
                                <dd><a href="javascript:;">添加库存</a></dd>
                                <dd><a href="javascript:;">修改库存</a></dd>
                                <dd><a href="javascript:;">查找库存</a></dd>
                                <dd><a href="javascript:;">删除库存</a></dd>
                          </dl>
                        </li>

        {#            <dd><a href="">超链接</a></dd>#}
                  </dl>
                </li>

                <li class="layui-nav-item">
                  <a href="javascript:;">采购</a>
                  <dl class="layui-nav-child">
                    <dd><a href="javascript:;">添加进货信息</a></dd>
                    <dd><a href="javascript:;">修改进货信息</a></dd>
                    <dd><a href="javascript:;">查找进货信息</a></dd>
                      <dd><a href="javascript:;">删除进货信息</a></dd>
                  </dl>
                </li>
                  <li class="layui-nav-item">
                      <a href="javascript:;">销售</a>
                      <dl class="layui-nav-child">
                        <dd><a href="javascript:;">添加销售信息</a></dd>
                        <dd><a href="javascript:;">修改销售信息</a></dd>
                        <dd><a href="javascript:;">查找销售信息</a></dd>
                          <dd><a href="javascript:;">删除销售信息</a></dd>
                      </dl>
                  </li>
              <li class="layui-nav-item">
                      <a href="javascript:;">药品厂家管理</a>
                      <dl class="layui-nav-child">
                        <dd><a href="javascript:;">添加药品厂家信息</a></dd>
                        <dd><a href="javascript:;">修改药品厂家信息</a></dd>
                        <dd><a href="javascript:;">查找药品厂家信息</a></dd>
                          <dd><a href="javascript:;">删除药品厂家信息</a></dd>
                      </dl>
                  </li>


          </ul>
        </div>
      </div>

  <div class="layui-body">
    <!-- 内容主体区域 -->
   <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
    {% load static %}
  <title>table模块快速使用</title>
  <link rel="stylesheet" href="{% static  "lib/layui/css/layui.css" %}" media="all">

</head>
<body>
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>药品进销管理系统</legend>
</fieldset>
<table id="demo" lay-filter="test"></table>

<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">
      <button class="layui-btn layui-btn-sm" lay-event="addData">添加数据</button>
    <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
    <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
    <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
  </div>
</script>

<script src="{% static  "lib/layui/layui.js" %}"></script>
<script>
layui.use('table', function(){
  var table = layui.table;

  //第一个实例
  table.render({
    elem: '#demo'
    ,url:'/medicine/get_medicine_data'
    ,toolbar: '#toolbarDemo'
    ,title: '药品信息数据表'
    ,totalRow: true
    ,cols: [[
      {type: 'checkbox', fixed: 'left'}
      ,{field:'id', title:'ID', width:120, fixed: 'left', unresize: true, sort: true, totalRowText: '合计'}
      ,{field:'medicine_name', title:'药品名称', width:200, edit: 'text'}
      ,{field:'scale', title:'规格', width:150}
      ,{field:'batch_num', title:'批次号', width:150}
      ,{field:'approval_num', title:'批准文号', width:150, edit: 'text'}
      ,{field:'effects', title:'功效', width:400}
      ,{field:'bzq', title:'保质期'}
      ,{field:'runit_price', title:'零售价', width:150, sort:true,  totalRow: true}
      ,{field:'wunit_price', title:'批发价', width:150, sort:true,  totalRow: true}
      ,
    ]]
      , id: 'testReload'
    ,page: true
  });

  table.on('toolbar(test)', function(obj){
    var checkStatus = table.checkStatus(obj.config.id);
    switch(obj.event){

      case 'getCheckData':
        var data = checkStatus.data;
        layer.alert(JSON.stringify(data));
      break;
      case 'getCheckLength':
        var data = checkStatus.data;
        layer.msg('选中了：'+ data.length + ' 个');
      break;
      case 'isAll':
        layer.msg(checkStatus.isAll ? '全选': '未全选')
      break;
    };
  });

  var $ = layui.$, active = {
        reload: function () {
          var demoReload = $('#demoReload');

          //执行重载
          table.reload('testReload', {
            page: {
              curr: 1 //重新从第 1 页开始
            }
            , where: {
              id: demoReload.val()
            }
          }, 'data');
        }
      };

  $('.demoTable .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
      });

});
</script>

</body>
</html>

  </div>

  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © lzxworkable@163.com
  </div>
</div>

<script>
//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element;

});
</script>
</body>
</html>

